package com.zhengxin.one.service.impl;

import com.zhengxin.one.common.ApiException;
import com.zhengxin.one.common.ErrorHandler;
import com.zhengxin.one.common.Result;
import com.zhengxin.one.service.FileService;
import io.netty.util.concurrent.GlobalEventExecutor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@Service
public class FileServiceIpml implements FileService {
    //文件上传
    @Override
    public String upload(MultipartFile file){
        String filePath = "C:/Users/zx021/Desktop/file";
        File fileUpload = new File(filePath);
        System.out.println(file);
        try {
            file.transferTo(fileUpload);
            return ("成功");
        }catch (Exception e){
            System.out.println(e);
            e.printStackTrace();
            return ("上传日志文件到服务器失败");
        }
    }
}
